import { InjectionKey } from 'vue'
import { createStore, Store, useStore as baseUseStore } from 'vuex'
import user from './modules/user'
import cacheView from './modules/cache-view'
import dict from './modules/dict'
import getters from './getters'

const store = createStore<Store.RootState>({
  modules: {
    user,
    cacheView,
    dict
  },
  getters
})

export function useStore() {
  return baseUseStore(storeKey)
}
export const storeKey: InjectionKey<Store<Store.RootState>> = Symbol()

export default store
